package com.dbb.entity;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.dbb.util.StringUtil;
import com.goldstone.entity.AuditableEntity;

@Entity
@Table(name = "CONTACT")
public class Contact extends AuditableEntity {
	private String name;
	private String email;
	private String company;
	private String address;
	private String expAddress;
	private String phone;
	private String fax;
	private String cellPhone;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCellPhone() {
		return cellPhone;
	}

	public void setCellPhone(String cellPhone) {
		this.cellPhone = cellPhone;
	}
	
	public String getExpAddress() {
		return expAddress == null ? address : expAddress;
	}

	public void setExpAddress(String expAddress) {
		this.expAddress = expAddress;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public static Contact createContact() {
		Contact contact = new Contact();
		contact.setCellPhone(StringUtil.getCellPhoneNum());
		contact.setEmail(StringUtil.getEmail());
		contact.setId(StringUtil.getRandomFirstUpperString(30, 31));
		contact.setName(StringUtil.getRandomArray(StringUtil.userCnNames));
		return contact;
	}

}
